package com.learner.ucenter.service.impl;

import com.learner.pojo.user.SensitiveMessage;
import com.learner.pojo.user.vo.SensitiveMessageResultVo;
import com.learner.ucenter.service.SensitiveMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author linweibing
 * @date 2023-03-28 19:42
 * @description: TODO
 */
@Service
public class SensitiveMessageServiceImpl implements SensitiveMessageService {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public void addSensitiveMessage(SensitiveMessage sensitiveMessage) {
        mongoTemplate.save(sensitiveMessage);
    }


    @Override
    public List<SensitiveMessageResultVo> getSensitiveMessageList() {
        return mongoTemplate.findAll(SensitiveMessageResultVo.class, "sensitiveMessages");
    }
}
